package cate.game.role.farm.adventure.task;

import cate.common.table.res.adventuretask.AdventureTaskBaseRow;
import cate.game.GameBody;
import cate.game.util.GameKit;
import com.fasterxml.jackson.annotation.JsonIgnore;
import easy.java.dev.note.NoteField;
import org.springframework.data.annotation.Id;

import java.util.List;

public class ProcessTask {
    @Id
    public String uid;
    @NoteField("任务id")
    public int taskId;
    @NoteField("开始时间")
    public long startTime;
    @NoteField("英雄id")
    public List<String> heroIds;

    public ProcessTask() {

    }

    @JsonIgnore
    public AdventureTaskBaseRow getRow(GameBody gameBody) {
        return gameBody.table.adventureTask.base.get(taskId);
    }

    public ProcessTask(int taskId) {
        this.uid = GameKit.uid();
        this.taskId = taskId;
    }

    public void acceptTask(List<String> heroIds) {
        this.heroIds = heroIds;
        this.startTime = System.currentTimeMillis();
    }
}
